package com.oh.core.common.constant;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * 常量配置
 */
@Configuration
public class ConfigConst implements InitializingBean {

    // 魔数
    public static int MAGIC_NUMBER;

    public static int MAGIC_NUMBER_CLIENT;

    @Value("${oh.msg.magicNumber:0x123456}")
    private int MAGIC_NUMBER_CONFIG;

    @Value("${oh.msg.magicNumClient:5710}")
    private int MAGIC_NUMBER_CLIENT_CONFIG;

    // 消息头长度
    public static int HEAD_LEN = 9;

    @Override
    public void afterPropertiesSet() throws Exception {
        MAGIC_NUMBER = MAGIC_NUMBER_CONFIG;
        MAGIC_NUMBER_CLIENT = MAGIC_NUMBER_CLIENT_CONFIG;
    }
}
